<?php

namespace App\Services;

use App\Models\AiLog;
use Slowlyo\OwlAdmin\Services\AdminService;

/**
 * 请求日志
 *
 * @method AiLog getModel()
 * @method AiLog|\Illuminate\Database\Query\Builder query()
 */
class AiLogService extends AdminService
{
	protected string $modelName = AiLog::class;
    public function searchable($query)
    {
        parent::searchable($query);

        $query->when($this->request->input('prompt'), fn($q) => $q->where('prompt', 'like', '%' . $this->request->input('prompt') . '%'));

        $query->when($this->request->input('text_request_id'), fn($q) => $q->where('text_request_id', 'like', '%' . $this->request->input('text_request_id') . '%'));
    }
}
